﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication2
{
    public partial class FeefteenCell : UserControl
    {
        Label label;
        public int val;
        Game game;
        public FeefteenCell(Game game, int val)
        {
            this.val = val;
            this.game = game;

            string value = "" + (val+1);
            
            InitializeComponent();
            if (val == game.emptyPos)
            {
                this.BackColor = Color.Gray;
                value = "";
            }

            label = new Label() { Text = value, Anchor = AnchorStyles.Top , AutoSize = true };
            this.Controls.Add(label);

            //this.Click += FeefteenCell_Click;
        }
        /*
        private void FeefteenCell_Load(object sender, EventArgs e)
        {
            game.click(val);
        }
        */
        private void FeefteenCell_Click(object sender, EventArgs e)
        {
            game.click(this);
        }
    }
}
